#ifndef GRAPHICS_H
#define GRAPHICS_H

#include "def.h"
#include "cmus-rg.h"
#include "parser.h"
#include "input.h"
#include "commands.h"

void init_graphics(SDL_Window **window, SDL_Renderer **renderer, SDL_Texture **display, TTF_Font **font, bool *render_change, button_node **root, button_node **tail);
void init_buttons(button_node **root, button_node **tail);
void cleanup_graphics(SDL_Window **window, SDL_Renderer **renderer);

void set_render_change(bool *render_change);
void pre_render(SDL_Renderer **renderer, SDL_Texture **display);
void update_render(SDL_Renderer **renderer, SDL_Texture **display, bool *render_change);

void draw_frames(SDL_Renderer **renderer, TTF_Font **font, bool *render_changed, int frame);
void draw_cover_art(SDL_Renderer **renderer, bool *render_changed, track *cr_track);
void draw_info(SDL_Renderer **renderer, TTF_Font **font, bool *render_change, track *cr_track, player *cr_player);
void draw_buttons(SDL_Renderer **renderer, bool *render_change, button_node *root);

void draw_bg(SDL_Renderer **renderer, bool *render_change, uint32_t color);
void draw_rect(SDL_Renderer **renderer, bool *render_change, int x, int y, int w, int h);
void draw_text_and_bg(SDL_Renderer **renderer, TTF_Font **font, bool *render_change, int x, int y, char *text, uint32_t color);
void draw_text(SDL_Renderer **renderer, TTF_Font **font, bool *render_change, int x, int y, char *text, uint32_t color);
void draw_img(SDL_Renderer **renderer, SDL_Texture **display, bool *render_change, char *file, SDL_Rect* rect);

int partr(uint32_t color);
int partg(uint32_t color);
int partb(uint32_t color);
int parta(uint32_t color);

int posx(int x, int w);
int posy(int y, int w);

#endif